const { DataTypes } = require('sequelize');
const sequelize = require('@shared/utils/database');

const Payment = sequelize.define('Payment', {
  id: {
    type: DataTypes.BIGINT,
    primaryKey: true,
    autoIncrement: true,
    comment: '支付ID'
  },
  order_id: {
    type: DataTypes.BIGINT,
    allowNull: false,
    comment: '订单ID'
  },
  payment_no: {
    type: DataTypes.STRING(64),
    allowNull: false,
    comment: '支付流水号'
  },
  transaction_id: {
    type: DataTypes.STRING(64),
    allowNull: true,
    comment: '微信支付订单号'
  },
  amount: {
    type: DataTypes.DECIMAL(10, 2),
    allowNull: false,
    comment: '支付金额'
  },
  status: {
    type: DataTypes.TINYINT,
    allowNull: false,
    comment: '支付状态：0-待支付 1-支付成功 2-支付失败'
  }
}, {
  tableName: 'payment',
  timestamps: true,
  createdAt: 'create_time',
  updatedAt: 'update_time',
  indexes: []
});

module.exports = Payment; 